package com.Vronsky.core.utils;

import java.util.Objects;

/**
 * @Classname Asset
 * @Description 断言
 * @Date 2024/7/11 10:04
 * @Created by zjh
 */
public class Assert {

    private Assert(){
        throw new UnsupportedOperationException();
    }

    /**
     * @description 判断字符串是否是空
     * @param value 字符串
     * @param message 抛出异常时的信息
     * @return void
     * @author zjh
     * @date 2024/7/11 10:08
     */
    public static void hasText(String value,String message){
        if (Objects.isNull(value) || "".equals(value)){
            throw new IllegalArgumentException(message);
        }
    }

    /**
     * @description 判断对象是否是null
     * @param object 对象
     * @param message 抛出异常时的信息
     * @return void
     * @author zjh
     * @date 2024/7/11 10:09
     */
    public static void notNull(Object object,String message){
        if (Objects.isNull(object)){
            throw new IllegalArgumentException(message);
        }
    }

}
